{
  "properties" : { },
  "id" : "copy1735809073636d9812",
  "script" : null,
  "groupId" : "b639e1fdd9604380bd82d98b60ea6a03",
  "name" : "3.样例time",
  "createTime" : null,
  "updateTime" : 1735811160327,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/time",
  "method" : "GET",
  "parameters" : [ {
    "name" : "page",
    "value" : "1",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "size",
    "value" : "100",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": {\n        \"now\": \"2025-01-02 17:11:43\",\n        \"origin\": \"2024-12-26 17:11:43\",\n        \"date: \": \"2024-12-02 17:25:36\"\n    },\n    \"timestamp\": 1735809103372,\n    \"executeTime\": 21\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "now",
        "value" : "2025-01-02 17:11:43",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "origin",
        "value" : "2024-12-26 17:11:43",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "date: ",
        "value" : "2024-12-02 17:25:36",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      } ]
    }, {
      "name" : "timestamp",
      "value" : "1735809103372",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "21",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import java.time.LocalDateTime;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.time.format.DateTimeFormatter;
 
var formatStr = "yyyy-MM-dd HH:mm:ss";
var format = DateTimeFormatter.ofPattern(formatStr);
 
// 获取指定日期 7 天之前的时间对象
var currentTime = LocalDateTime.now();
var nDaysAgoTime = currentTime.minus(7, ChronoUnit.DAYS);
 
// 获取当前日期的0时0分0秒
var startOfDay = LocalDate.now().atStartOfDay();

// "2024-12-02 17:25:36" 字符串 转时间对象 
var dateTimeStr = "2024-12-02 17:25:36";
var dateTimeObj = LocalDateTime.parse(dateTimeStr, format);




// 假设给定时间
LocalDateTime startDate = LocalDateTime.of(2024, 12, 30, 0, 0);  // 示例：2024年12月30日 00:00:00

// 获取当前时间
LocalDateTime now = LocalDateTime.now();

// 输出给定时间和当前时间
System.out.println("给定时间: " + startDate);
System.out.println("当前时间: " + now);

// 循环从给定时间递减每一天，并输出
LocalDateTime currentDay = startDate;
while (!currentDay.isAfter(now)) {
    System.out.println(currentDay.toLocalDate()); // 输出每一天的日期部分
    currentDay = currentDay.plusDays(1); // 递增一天
}


return {
    "now": currentTime.format(format),
    "origin": nDaysAgoTime.format(format),
    "date: ": dateTimeObj.format(format)
}
